package com.android.locationapi.maps;

import java.util.HashMap;
import java.util.List;

public class Server {

	private String myName=null;
	private HashMap<String, String> friendsList = new HashMap<String, String>();

	public Server()
	{
		
	}
	public Server(String name)
	{
		this.myName = name;
	}
	
	/**
	 * Checks if a friend already exists
	 * @param friendName - Name of the friend being checked for
	 * @return - true if friend exists, false otherwise
	 */
	private boolean FriendExists(String friendName)
	{
		if(this.friendsList.containsKey(friendName))
			return true;
		else return false;
	}
	
	/**
	 * Adds a friend to a user's friend list
	 * @param name
	 * @param email
	 * @return 0 if successful, 1 if name is null, 2 if email is null,
	 * 3 if friend already exists
	 */
	public int AddFriend(String name, String email)
	{
		if(name==null)
			return 1;
		if(email==null)
			return 2;
		if(FriendExists(name))
			return 3;
		
		this.friendsList.put(name, email);
		return 0;
	}
	
}
